package com.ewili.framework.utils;

import javax.servlet.http.HttpServletResponse;
import java.nio.charset.Charset;

/**
 * Created by Administrator on 2017/11/17.
 */
public class GlobalConstant {

    public static String UTF8_CHARSET_NAME = "UTF-8";

    /**
     * UTF-8 charset
     */
    public static final Charset UTF8_CHARSET = Charset.forName(UTF8_CHARSET_NAME);

    /**
     * String型的true false
     *
     * @author leo
     */
    public static final class BOOL {
        /**
         * 真
         */
        public static final String TRUE = "1";
        /**
         * 假
         */
        public static final String FALSE = "0";
    }

    /**
     * 有效状态
     */
    public static final class Valid {
        /**
         * 有效
         */
        public static final String VALID = "1";
        /**
         * 无效
         */
        public static final String INVALID = "0";
    }


    /**
     * 响应状态码
     */
    public static final class ResponseStatus {

        /**
         * 成功
         */
        public static final int SUCCESS = 0;

        /**
         * 用户名或密码错误
         */
        public static final int BAD_USERNAME_OR_PASSWORD = 1;

        /**
         * 数据不完整
         */
        public static final int INCOMPLETE_DATA = 2;

        /**
         * 网络异常
         */
        public static final int SOCKET_ERROR = 3;

        /**
         * 不支持的货币对
         */
        public static final int UNSUPPORT_SYMBOL = 4;

        /**
         * 电话号已被注册
         */
        public static final int PHONE_IN_USE = 5;

        /**
         * 账号已被锁定
         */
        public static final int ACCOUNT_LOCKED = 7;

        /**
         * 图片验证码错误
         */
        public static final int BAD_VERIFY_CODE = 8;

        /**
         * 用户未激活
         */
        public static final int ACCOUNT_NONACTIVATED = 9;

        /**
         * 短信验证码错误超过次数，请重新获取
         */
        public static final int OUT_OF_BAD_SMS_COUNT = 10;

        /**
         * 短信验证码已过期或者还未获取验证码
         */
        public static final int SMS_VERIFY_CODE_PASS_DUE = 11;

        /**
         * 短信验证码错误
         */
        public static final int BAD_SMS_VERIFY_CODE = 12;

        /**
         * 图片验证码已过期
         */
        public static final int VERIFY_CODE_PASS_DUE = 13;

        /**
         * 未选择身份
         */
        public static final int NOT_CHECK_ROLE = 14;


        /**
         * 错误请求
         */
        public static final int BAD_REQUEST = HttpServletResponse.SC_BAD_REQUEST; //400;

        /**
         * 未授权
         */
        public static final int UNAUTHORIZED = HttpServletResponse.SC_UNAUTHORIZED;//401

        /**
         * 资源未找到
         */
        public static final int NOT_FOUNT = HttpServletResponse.SC_NOT_FOUND;//404

        /**
         * 不允许的请求方法
         */
        public static final int METHOD_NOT_ALLOWED = HttpServletResponse.SC_METHOD_NOT_ALLOWED;//405

        /**
         * 不支持的媒体类型
         */
        public static final int UNSUPPORTED_MEDIA_TYPE = HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE;//415

        /**
         * 内部异常
         */
        public static final int INTERNAL_SERVER_ERROR = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;//500

        /**
         * 服务器繁忙
         */
        public static final int SERVICE_UNAVAILABLE = HttpServletResponse.SC_SERVICE_UNAVAILABLE;//503

        /**
         * 没有权限
         */
        public static final int NOT_HAVE_PERMISSION = 403;

        /**
         * 未知异常
         */
        public static final int ERROR = 900;

    }

    /**
     * 资源类型，[menu|button]
     */
    public static final class ResourceType {
        /**
         * 资源类型，[menu]
         */
        public static final String MENU = "menu";
        /**
         * 资源类型，[button]
         */
        public static final String BUTTON = "button";
    }
}
